//
//  itMainViewController.swift
//  iiatn
//
//  Created by mnine on 18/3/25.
//  Copyright © 2018年 mnine. All rights reserved.
//

import UIKit

class itMainViewController: UITabBarController {

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // 切换卡导航
        let tabBar = UITabBar.appearance()
        tabBar.tintColor = WColor(r: 245, g: 90, b: 93, a: 1/0)
        addChildViewControllers()
    }

    /**
     * 添加子控制器
     */
    private func addChildViewControllers() {
        addChildViewController(childController: WHomeMainViewController(), title: "首页", imageName: "TabBar_home_23x23_")
        addChildViewController(childController: WZixunViewController(), title: "资讯", imageName: "TabBar_zixun_23x23_")
        addChildViewController(childController: WMyViewController(), title: "我的", imageName: "TabBar_me_boy_23x23_")
    }
    
    /**
     # 初始化子控制器
     
     - parameter childControllerName: 需要初始化的控制器
     - parameter title:               标题
     - parameter imageName:           图片名称
     */
    private func addChildViewController(childController: UIViewController, title: String, imageName: String) {
        childController.tabBarItem.image = UIImage(named: imageName)
        childController.tabBarItem.selectedImage = UIImage(named: imageName + "selected")
        childController.title = title
        let navC = itNavigationController(rootViewController: childController)
        addChildViewController(navC)
    }

}
